package cn.xy.base.server.utils;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.img.ImgUtil;
import cn.hutool.core.text.CharSequenceUtil;

import java.util.List;

/**
 *  @author xy
 */
public class ImgTypeUtil {

    private ImgTypeUtil() {
        throw new IllegalStateException("Utility class");
    }

    private static final List<String> TYPE_LIST = CollUtil.toList(ImgUtil.IMAGE_TYPE_JPEG, ImgUtil.IMAGE_TYPE_JPG,
            ImgUtil.IMAGE_TYPE_JPG, ImgUtil.IMAGE_TYPE_GIF, ImgUtil.IMAGE_TYPE_PNG);

    public static boolean isImage(String type) {
        if (CharSequenceUtil.isEmpty(type)) {
            return false;
        }
        return TYPE_LIST.contains(type);
    }

}
